package com.ccb.sc.common.modules.groupon.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ccb.sc.common.modules.groupon.entity.Groupon;
import com.ccb.sc.common.modules.groupon.entity.GrouponLog;
import com.ccb.sc.common.modules.groupon.mapper.GrouponLogMapper;
import com.ccb.sc.common.modules.groupon.mapper.GrouponMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ken
 * @version 1.0
 * @date 2025/2/23 12:15
 */
@Service
public class GrouponService extends ServiceImpl<GrouponMapper, Groupon> {

    @Autowired
    private GrouponLogMapper grouponLogMapper;

    public GrouponLog findByOrderId(String orderId) {
        return this.grouponLogMapper.selectOne(Wrappers.<GrouponLog>lambdaQuery().eq(GrouponLog::getOrderId, orderId).last("limit 1"));
    }


}
